package com.hww.slow_sql;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.Serializable;

/**
 * 慢SQL配置文件
 *
 * @author xiaojie
 * @date 2021/1/9 1:31 上午
 */
@Data
@Component
public class SlowSQLConfig implements Serializable {


    private static final long serialVersionUID = -515758050880376891L;

    /**
     * 慢SQL 自己的mapper
     */
    public static final String SLOW_SQL_MAPPER = "cn.hww.slow_sql.mapper.SlowSQLMapper";

    /**
     * 默认前缀配置
     */
    public static final String DEFAULT_SLOWSQL_PREFIX = "scm:slowsql:";
    public static final String DEFAULT_SLOWSQL_TIME_NAME = "slowsql.time";
    public static final String DEFAULT_SLOWSQL_MAXROWCOUNT_NAME = "slowsql.maxrowscount";

    /**
     * 默认慢SQL时间
     */
    public static final int DEFAULT_SLOWSQL_TIME = 10;


    /**
     * 默认大行数
     */
    public static final int DEFAULT_SLOWSQL_ROWCOUNT = -1;
    public static final int DEFAULT_SLOWSQL_MAXROWCOUNT = 2000;

    /**
     * 慢SQL默认超时时间, 单位秒
     */
    @Value("${slowsql.time:10}")
    private volatile int slowSqlTime;

    @Value("${slowsql.maxrowscount:2000}")
    private volatile int maxRowsCount;
}
